<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        a {
            text-decoration: none;
        }
        
        ul li {
            list-style: none;
        }
        
        body {
            width: 100%;
            height: 100%;
            background: url(img/1.jpg);
        }
        
        .box1 {
            box-sizing: border-box;
            margin: 98px auto;
            width: 411px;
            height: 70px;
            background: white;
        }
        
        .box1 ul {
            box-sizing: border-box;
            width: 411px;
            height: 70px;
            clear: both;
        }
        /* .box1 ul * {
            border: 1px solid red;
        }
         */
        
        .box1 ul li {
            box-sizing: border-box;
            margin-top: 4px;
            margin-right: 2px;
            float: left;
            width: 100px;
            height: 63px;
        }
        
        .box1 ul li:nth-child(1) {
            margin-left: 1px;
            /* background: red; */
        }
        
        .box1 ul li:nth-child(4) {
            margin-right: 0px;
            /* background: red; */
        }
        
        .box1 ul li a img {
            max-width: 100%;
        }
    </style>
</head>

<body>
    <div class="box1">
        <ul>
            <li>
                <a href="#"><img src="img/1.jpg" alt="背景"></a>
            </li>
            <li>
                <a href="#"><img src="img/2.jpg" alt="背景"></a>
            </li>
            <li>
                <a href="#"><img src="img/3.jpg" alt="背景"></a>
            </li>
            <li>
                <a href="#"><img src="img/4.jpg" alt="背景"></a>
            </li>
        </ul>
    </div>
    <script>
        // 6.百度换肤效果

        // 获取图片
        let aImgs = $("img");


        for (let i = 0; i < aImgs.length; i++) {
            let AImg = aImgs[i];
            AImg.onclick = function() {
                document.body.style.background = "url(" + this.src + ")";
            }
        }

        function $(select) {
            return document.querySelectorAll(select);
        }
    </script>
</body>

</html>